/*  This file is part of the KDE project
    Copyright (C) 2006-2007 Matthias Kretz <kretz@kde.org>

    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) version 3.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Library General Public License for more details.

    You should have received a copy of the GNU Library General Public License
    along with this library; see the file COPYING.LIB.  If not, write to
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    Boston, MA 02110-1301, USA.

*/

#include "main.h"
#include <kgenericfactory.h>
#include <ktabwidget.h>
#include <kaboutdata.h>
#include <kdeversion.h>
#include <kservicetypeprofile.h>
#include <kservicetypetrader.h>
#include <QtGui/QBoxLayout>
#include <kdialog.h>
#include <QLabel>
#include <QDebug>

#include "backendselection.h"
#include "snapshoteditor.h"

K_PLUGIN_FACTORY(WormholeKcmFactory, registerPlugin<WormholeKcm>();)
K_EXPORT_PLUGIN(WormholeKcmFactory("kcm_wormhole"))

WormholeKcm::WormholeKcm(QWidget *parent, const QVariantList &args)
    : KCModule(WormholeKcmFactory::componentData(), parent, args)
{
    KAboutData *about = new KAboutData(
            "kcm_wormhole", 0, ki18n("Wormhole server Configuration Module"),
            KDE_VERSION_STRING, KLocalizedString(), KAboutData::License_GPL,
            ki18n("Copyright 2008 Diego Rosario Brogna, Lorenzo Albano"));
    about->addAuthor(ki18n("Diego Rosario Brogna"), KLocalizedString(), "dierbro@gmail.com");
    about->addAuthor(ki18n("Lorenzo Albano"), KLocalizedString(), "albano.lorenzo@gmail.com");
    setAboutData(about);

    setLayout(new QHBoxLayout);
   
    KTabWidget *tabs = new KTabWidget(this);
    layout()->addWidget(tabs);

    m_snapshotEditorWidget = new SnapshotEditor;
    tabs->addTab(m_snapshotEditorWidget, i18n("Snapshot Preference"));
    m_backendSelection = new BackendSelection;
    tabs->addTab(m_backendSelection, i18n("Backend"));

   //connect(m_backendSelection, SIGNAL(changed()), SLOT(changed()));
    connect(m_snapshotEditorWidget, SIGNAL(changed()), SLOT(changed()));
    setButtons( KCModule::Default|KCModule::Apply );

}

void WormholeKcm::load()
{
  m_backendSelection->load();
qDebug() << "loaded";
}

void WormholeKcm::save()
{
m_snapshotEditorWidget->save();
/*KConfig config("wormholerc");
KConfigGroup generalGroup( &config, "General" );
KConfigGroup generalGroup2( &generalGroup, "General2" );
generalGroup2.writeEntry( "Account2", "aaaaaa" );
generalGroup2.config()->sync();
generalGroup.config()->sync();*/
}

void WormholeKcm::defaults()
{

}

#include "main.moc"
// vim: ts=4
